<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>vue</title>
    <script src='https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js'></script>
</head>

<body>
    <div id='app'>
        <!-- 方案1 -->
        <!-- <div v-if="flag">剑圣</div>
        <div v-if="flag">猴子</div>
        <div v-if="flag">冰女</div> -->

        <!-- 方案2: 多了一个 div 结构，父子关系打乱 -->
        <!-- <div v-if="flag">
            <div>剑圣</div>
            <div>猴子</div>
            <div>冰女</div>
        </div> -->

        <!-- 方案3： -->
        <template v-if="flag">
            <div>剑圣</div>
            <div>猴子</div>
            <div>冰女</div>
        </template>

    </div>
</body>
<script>
    let vm = new Vue({
        el: '#app',
        data: {
            flag: true
        }
    });
</script>

</html>